package com.llmops.core.tracing;

import com.llmops.core.Context;
import com.llmops.core.Node;

import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue;

public class ExecutionTracer {
    private static final ConcurrentLinkedQueue<ExecutionLog> logs = new ConcurrentLinkedQueue<>();

    public static void logStatusChange(Node node, Context context) {
        logs.add(new ExecutionLog(node.getId(),
                "STATUS_CHANGE",
                Map.of("status", context.getNodeStatus(node.getId())),
                null));
    }

    public static void logPreExecute(Node node, Context context) {
        logs.add(new ExecutionLog(node.getId(), 
                "PRE_EXECUTE", 
                context.getInputParams(node.getId()), 
                null));
    }

    public static void logPostExecute(Node node, Context context) {
        logs.add(new ExecutionLog(node.getId(),
                "POST_EXECUTE",
                context.getInputParams(node.getId()),
                context.getOutputParams(node.getId())));
    }

    public static void clear() {
        logs.clear();
    }
}